import {ORDERINFO, GET_ORERS } from '../mutations-type'
import { getOrders,getOrderinfos,searchs} from '../../api/order'
const order = {
    state: {
        orders: {
        },
        orderInfo: {
        },
        // searchInfo: {
        // },
    },
    mutations: {
        [GET_ORERS](state, obj) {
            state.orders = obj
        },
        [ORDERINFO](state, obj) {
            state.orderInfo = obj
        },
        // [ORDERSERCHS](state, obj) {
        //     state.searchInfo = obj
        // },

    },
    actions: {
        async getOrders({ commit },obj) {
            let orders = await getOrders(obj)
            console.log(2222, orders)
            commit('GET_ORERS', orders.data.data)
        },
        async getOrderinfos({ commit },obj) {
            let orders = await getOrderinfos(obj)
            console.log(2222, orders)
            commit('ORDERINFO', orders.data.data)
        },
        async searchs({ commit },obj) {
            let orders = await searchs(obj)
            console.log(2222, orders)
            commit('GET_ORERS', orders.data.data)
        }
    }

}

export default order